<template>
  <div class="page_withdrawalRecords">
    <van-nav-bar
      title="提现记录"
      left-arrow
      @click-left="$router.back()"
    />
    <van-cell style="font-size: 12px" v-if="recordArr.length">
      <com-withdrawal-records :recordArr="recordArr"></com-withdrawal-records>
    </van-cell>



  </div>
</template>

<script>
  import comWithdrawalRecords from '../../components/comWithdrawalRecords';
  import {Toast} from 'vant';
  export default {
    name: 'withdrawalRecords',
    components: {
      comWithdrawalRecords,
    },
    data(){
      return {
        recordArr: [
          {
            "id": 1,
            "createdate": "2020-10-09 16:51:42",
            "money": 441000,
            "name": "代招费到账",
            'acctype': 0,
          },
          {
            "id": 2,
            "createdate": "2020-10-09 16:51:42",
            "money": 666000,
            "name": "代招费到账",
            'acctype': 0,
          },
        ],
        cashOutSign: '',
      }
    },
    created(){
      if (this.$route.params.id){
        this.cashOutSign = this.$route.params.id
      } else {
        this.$router.back()
      }
    },

    mounted() {
      // 局部变量
      let url
      switch (this.cashOutSign) {
        case 'lendMoney':
          url = '';
          // this._cashOutSign_all(url);
          break;
        default:
          // 默认是：工资wage
          url = '';
          // this._cashOutSign_all(url);
      }
    },

    methods:{
      async _cashOutSign_all(url){
        if (url){
          // 需要修改
          const res =  await this.$api.stock.reqDrawCash(url)
          if (res.code === 200){
            Toast(res.data)
            await this.$router.back()
          }
        } else {
          Toast('提现记录参数有误，请退出登录重试！')
        }

      },
    }


  }
</script>

<style lang="scss" scoped>
  .page_withdrawalRecords{
    width: 100%;
  }
</style>
